/*
 * Copyright (c) 2006-2020, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 */

#include <rtthread.h>

#include "board.h"
#include "__def.h"
#include "timer.h"

/*
 * SysTick Initiation
 */
int rt_hw_tick_init(void)
{
    timer_init(TIM1, CPU_FREQ_MHZ-1, (1000/RT_TICK_PER_SECOND)*1000); // tick = 1ms
    timer_control(TIM1, TIM_EN);
}

void timer1_handler(void)
{
    rt_tick_increase();
}
